package com.yuxin.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import com.yuxin.vo.City;
import com.yuxin.vo.Forecast;
import com.yuxin.vo.Weather;
import com.yuxin.vo.WeatherResponse;


/**
 * Weather Report Service.
 *
 * @author <a href="https://waylau.com">Way Lau</a>
 * @since 1.0.0 2017年11月26日
 */
@Service
public class WeatherReportServiceImpl implements WeatherReportService {

    @Autowired
    private RestTemplate restTemplate;

    @Override
    public Weather getDataByCityId(String cityId) {

        WeatherResponse weatherResponse = restTemplate.getForObject("http://SERVICE-DATA/weather/cityId/"+cityId, WeatherResponse.class);

        Weather data = weatherResponse.getData();
        return data;
    }

}
